package cn.wolfcode.trip.web.controller;


import cn.wolfcode.trip.base.domain.PointMsg;
import cn.wolfcode.trip.base.query.PointMsgQueryObject;
import cn.wolfcode.trip.base.service.IPointMsgService;
import cn.wolfcode.trip.base.util.JSONResult;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/pointMessage")
public class PointMsgController {

    @Autowired
    private IPointMsgService pointMsgService;


    @RequestMapping("/list")
    public String list(Model model, @ModelAttribute("qo") PointMsgQueryObject qo) {
        PageInfo<PointMsg> pageInfo = pointMsgService.selectForList(qo);
        model.addAttribute("result", pageInfo);
        return "pointMessage/list";
    }

    @RequestMapping("/delete")
    @ResponseBody
    public Object delete(Long id) {
        JSONResult result = new JSONResult();
        pointMsgService.delete(id);
        return result;
    }
}
